package com.pactera.asmp.server.entity;

import com.fasterxml.jackson.annotation.JsonFormat;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;

import javax.validation.Valid;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class TaskDtoV2 {
    private  Integer id;
    @NotNull(message = "項目ID不允许为空")
    private  Integer projectId;
    private String projectName;
    @NotEmpty(message = "任务名称不允许为空")
    @Size(max = 200,message = "任务名称长度不能超过200")
    private String name;
    @NotNull(message = "执行方式不允许为空")
    private Integer cycleType; //0 定期执行， 1，延时执行， 2， 立刻执行
    @NotNull(message = "任务类型不允许为空")
    private Integer assignType;  // 0. 单点式分派执行   1. 分布式分派执行
    @NotNull(message = "计划时间不允许为空")
    @Size(max = 100,message = "计划时间长度0-100")
    private String cron;
    @NotNull(message = "执行次数不允许为空")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private LocalDate validityDateStart;
    @JsonFormat(pattern = "yyyy-MM-dd")
    private LocalDate validityDateEnd;

    private Integer exeNumber;
    @NotNull(message = "脚本不允许为空")
    private Integer[] scriptIds;

    @Valid
    @NotNull(message = "设备不允许为空")
    private List<TaskDeviceDtoV2> devices;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;
    private Integer createUserId;
    private String createUserName;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateTime;
    private Integer updateUserId;
    private String updateUserName;
}
